
/**
 * @fileoverview A simple task model implementation.
 * Date: 2012/03/25
 * Time: 10:00 AM
 */



goog.provide('lfpug.model.Task');
goog.provide('lfpug.model.Task.Property');
goog.require('goog.ui.IdGenerator');
goog.require('lfpug.model.BaseModel');
goog.require('lfpug.model.IDescriptiveModel');



/**
 * @constructor
 * @implements {lfpug.model.IDescriptiveModel}
 * @extends {lfpug.model.BaseModel}
 *
 * @param {string} id The unique id of this story.
 */
lfpug.model.Task = function(id) {
  goog.base(this, id);
};
goog.inherits(
    lfpug.model.Task,
    lfpug.model.BaseModel
);


/**
 * @type {!string}
 * @private
 */
lfpug.model.Task.prototype.description_ = '';


/**
 * @type {!string}
 * @private
 */
lfpug.model.Task.prototype.name_ = '';


/**
 * @type {!number}
 * @private
 */
lfpug.model.Task.prototype.hoursRemaining_ = 0;


/**
 * @type {!number}
 * @private
 */
lfpug.model.Task.prototype.hoursEstimated_ = 0;


/**
 * @return {!string} The Description of the model.
 */
lfpug.model.Task.prototype.getDescription = function() {
  return this.description_;
};


/**
 * @param {!string} value The description of the model.
 */
lfpug.model.Task.prototype.setDescription = function(value) {
  if (value != this.description_) {
    this.description_ = value;
    this.invalidate(lfpug.model.Task.Property.DESCRIPTION);
  }

};


/**
 * @param {!string} value Setter for name.
 */
lfpug.model.Task.prototype.setName = function(value) {
  if (this.name_ != value) {
    this.name_ = value;
    this.invalidate(lfpug.model.Task.Property.NAME);
  }

};


/**
 * @return {!string} The models name property.
 */
lfpug.model.Task.prototype.getName = function() {
  return this.name_;
};


/**
 * @param {!number} value Setter for hoursRemmianing.
 */
lfpug.model.Task.prototype.setHoursEstimated = function(value) {
  if (this.hoursEstimated_ != value) {
    var prevValue = this.hoursEstimated_;
    this.hoursEstimated_ = value;
    this.invalidate(
        lfpug.model.Task.Property.HOURS_ESTIMATED, prevValue, value);
  }
};


/**
 * @return {!number} The models name property.
 */
lfpug.model.Task.prototype.getHoursEstimated = function() {
  return this.hoursEstimated_;
};


/**
 * @param {!number} value Setter for hoursRemmianing.
 */
lfpug.model.Task.prototype.setHoursRemaining = function(value) {
  if (this.hoursRemaining_ != value) {
    var prevValue = this.hoursRemaining_;
    this.hoursRemaining_ = value;
    this.invalidate(
        lfpug.model.Task.Property.HOURS_REMAINING, prevValue, value);
  }
};


/**
 * @return {!number} The models name property.
 */
lfpug.model.Task.prototype.getHoursRemaining = function() {
  return this.hoursRemaining_;
};


/**
 * @enum {string}
 */
lfpug.model.Task.Property = {
  NAME: goog.ui.IdGenerator.getInstance().getNextUniqueId(),
  HOURS_REMAINING: goog.ui.IdGenerator.getInstance().getNextUniqueId(),
  HOURS_ESTIMATED: goog.ui.IdGenerator.getInstance().getNextUniqueId(),
  DESCRIPTION: goog.ui.IdGenerator.getInstance().getNextUniqueId()
};


